package ${package.Controller};


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
<#if swagger>
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
</#if>
import com.my.house.common.ApiResult;
import ${package.Entity}.${entity};
<#if config.templateConfig.service??>
 import ${package.Service}.${table.serviceName};
<#else>
 import ${package.ServiceImpl}.${table.serviceImplName};
</#if>
<#if restControllerStyle>
import org.springframework.web.bind.annotation.RestController;
<#else>
import org.springframework.stereotype.Controller;
</#if>
<#if superControllerClassPackage??>

</#if>

/**
 * <p>
 * ${table.comment!} 前端控制器
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
<#if restControllerStyle>
@Slf4j
@RestController
<#else>
@Controller
</#if>
<#if swagger>
@Api(tags = "${table.comment!}相关接口")
</#if>
@RequestMapping("<#if package.ModuleName?? && package.ModuleName != "">/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
<#if kotlin>
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>
<#if superControllerClass??>
public class ${table.controllerName} extends ${superControllerClass} {
<#else>
public class ${table.controllerName} {
</#if>
    @Autowired
 <#if config.templateConfig.service??>
    private ${table.serviceName} ${table.serviceName?uncap_first};
 <#else>
    private ${table.serviceImplName} ${table.serviceImplName?uncap_first};
 </#if>

    @GetMapping("/find-by-id")
 <#if swagger>
    @ApiOperation("根据ID获取记录")
    @ApiImplicitParam(name = "id", value = "记录id", required = true, dataType = "long", paramType = "query")
 </#if>
    public ApiResult<${entity}> findById(Long id) {
        log.info("/${controllerMappingHyphen}/find-by-id, id={}", id);
   <#if config.templateConfig.service??>
        return ApiResult.ok(${table.serviceName?uncap_first}.getById(id));
   <#else>
        return ApiResult.ok(${table.serviceImplName?uncap_first}.getById(id));
   </#if>
    }
}
</#if>
